<template>
  <div class="header">
    <div class="headerBack">
      <div class="header-left">
        <img class="logo" src="../../assets/logo.png" alt="" />
        <span class="name">蜜蜂语音</span>
      </div>
      <div class="header-right">
        <div
          v-for="item in routerList"
          :key="item.id"
          @click="changeNav(item)"
          :class="active==item.id?'activeClass':''"
          >
          {{ item.name }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "navTab",
  props: {
    routerList: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  data(){
    return{
      active:1,
    }
  },
  methods: {
    changeNav(item) {
      if(item.id != this.active){
        this.$router.push({path:item.path});
        this.active = item.id;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100000;
  background: url(../../assets/images/07.png) -4rem -4rem;

  .headerBack {
    background: rgba(0, 0, 0, 0.3);
    padding: 10rem 100rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .header-left {
    display: flex;
    justify-content: start;
    align-items: center;
  }
  .header-right {
    display: flex;
    justify-content: end;
    div {
      height: 48rem;
      line-height: 48rem;
      padding: 0 14rem;
      border-radius: 9rem;
      color: #fff;
      font-family: "华文彩云";
      margin-right: 10rem;
      font-size: 20rem;
      /* transform: scale(0.8); */
    }
    div:hover {
      font-family: "华文琥珀";
      font-size: 24rem;
      background: #16825d;
      cursor: pointer;
      transition: all 0.5s;
    }
    .activeClass{
      font-family: "华文琥珀";
      font-size: 24rem;
      background: #16825d;
      transition: all 0.5s;
    }
  }

  .logo {
    width: 48rem;
    height: 48rem;
  }
  .name {
    font-size: 28rem;
    margin-left: 20rem;
    color: aliceblue;
    font-family: "华文彩云";
    margin-top: -4rem;
  }
}
</style>